1. Field of Invention
The invention relates to a method of image compression and decompression and, in particular, to a method of image compression and decompression in a compression and decompression chip with the JBIG standard.
2. Related Art
After sampling and digitization, an original picture will have a very large size of data. Such a large data size is very inconvenient in image processing, storage and transmissions. The image compression technique is to represent the same picture using less data, reducing the data transmission time.
The basic idea in image compression is to remove redundant data from the picture. The data redundancies in pictures have the following sources:
(1) Coding redundancy: Data with a greater probability to appear in a picture file can be represented by a shorter code.
(2) Interpixel redundancy: Since neighboring pixels have very high correlations, therefore, the data of a particular pixel can be derived from another.
JBIG (Joint Bi-level Image Group) is the black-and-white (BW) image compression standard set by CCITT in 1993. The method employed by the standard is to represent each pixel in a bi-level image by one bit. The complete image compression job can be achieved using a single CODEC (compression and depression) chip with the JBIG standard. As the JBIG technique is fairly mature, it has been widely used in printing and faxing.
The flowchart of the image data CODEC method in the JBIG standard is shown in FIG. 1. When the CODEC chip processes the data, all steps shown in the drawing have to be performed in each cycle T to compress or decompress each bit in the data.
First, the system performs memory access (step 10) to read data from memory. This step has to be done for either compressing or decompressing data. The accessed data are combined to form a context (CX), which is then used to look up a table and get a corresponding state (ST).
Step 20 performs look-up-table (LUT) to find the LSZ value corresponding to ST obtained in step 10. Afterwards, subtraction (A′=A−LSZ) is performed in step 30 to subtract the LSZ value obtained in step 20 from a default value A, obtaining an A′ value.
Step 40 performs a selection (A=A′ or A=LSZ) to determine which one to continue the subsequent operations. Afterwards, another subtraction (C′=C−A+LSZ) is performed (step 50). However, this time uses another default value C to find a new C′ value by subtracting A from C, added by the LSZ value.
Afterwards, step 60 performs a C value selection (C=C′ or C=C) to determine which one to use in subsequent operations. Step 70 is the renormalization to renormalize A between 0.5 and 1. Step 80 is the renormalization of C to scale it up.
Finally, step 90 performs byteout/bytein to output compressed or decompressed data to memory. This then concludes the flow of image data CODEC.
For a 100 MHz central processing unit (CPU), its work cycle is 10 ns. However, it takes about 10.5 ns to encode a single bit of the image data, from memory access (step 10) to byteout/bytein (step 90). For decoding, the circuit is more complicated and therefore the whole process takes about 11.5 ns.
In summary, we see that the time it takes for the CPU to complete either a compressing or decompressing task is longer than its work cycle. Thus, it will cause delays in image data processing and lower the printing speed of the printer.
If there is no way to reduce the time it takes to compress and decompress image data in each cycle, the printing speed will not be able to increased even when a faster CPU is used.